﻿//PortfolioPicker.xaml.cs
//Copyright (c) 2013 StockSharp LLC, all rights reserved.
//This code module is part of StockSharp library.
//This code is licensed under the GNU GENERAL PUBLIC LICENSE Version 3.
//See the file License.txt for the license details.
//More info on: http://stocksharp.com

namespace StockSharp.Xaml
{
	using System.Collections.Generic;
	using System.Windows;
	using System.Windows.Controls;

	using StockSharp.BusinessEntities;

	/// <summary>
	/// Окно выбора портфеля.
	/// </summary>
	partial class PortfolioPicker
	{
		/// <summary>
		/// Создать <see cref="PortfolioPicker"/>.
		/// </summary>
		public PortfolioPicker()
		{
			InitializeComponent();
		}

		/// <summary>
		/// Выбранный портфель.
		/// </summary>
		public Portfolio SelectedPortfolio
		{
			get { return PortfoliosCtrl.SelectedPortfolio; }
			set { PortfoliosCtrl.SelectedPortfolio = value; }
		}

		/// <summary>
		/// Доступные портфели.
		/// </summary>
		public IList<Portfolio> Portfolios
		{
			get { return PortfoliosCtrl.Portfolios; }
		}

		/// <summary>
		/// Шлюз к торговой системе.
		/// </summary>
		public ITrader Trader
		{
			get { return PortfoliosCtrl.Trader; }
			set { PortfoliosCtrl.Trader = value; }
		}

		private void OnOkClick(object sender, RoutedEventArgs e)
		{
			DialogResult = true;
		}

		private void PortfoliosCtrlSelectionChanged(object sender, SelectionChangedEventArgs e)
		{
			Ok.IsEnabled = SelectedPortfolio != null;
		}
	}
}